<?php


ini_set('display_errors', 1); 
ini_set('error_reporting', 'E_error'); 
session_start();
ob_start();
$sessid=session_id();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php require_once "includes/config.php";require_once "includes/functions.php";if(isset($_GET["policy"])) echo "Swapen.com - Privacy Policy";else if(isset($_GET["terms"])) echo "Swapen.com - Terms and Conditions";else echo "Swapen.com - Buy and Sell";?></title>
<script src="js/spry/SpryTabbedPanels.js" type="text/javascript"></script>
<link href="js/spry/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
<link href="includes/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/functions.js"></script>
</head>
<body>
<?php 
	$user = checkSession();
	$userId= $user['id'];
	$userName= $user['name'];
	$userType= $user['type'];
?>

<?php 
	// 1:23 PM, May 29, 2011
	
	$is_pass_amazone_land = false;
	if( isset($_SESSION['user_id_sess']) ){
		$query = "SELECT set_api, comm_tokenID FROM tbl_users WHERE user_id =".$userId;
		$sqlQuery = mysql_query($query);
		$fetchDataArr = mysql_fetch_array($sqlQuery);
		if( strtolower($fetchDataArr['set_api']) == 'yes' && $fetchDataArr['comm_tokenID'] != ''){
			$is_pass_amazone_land = true;
		}
	}
?>

<table width="950" border="0" align="center" bgcolor="#FFFFFF">
  <tr>
    <td height="119"><?php include_once "header.php";?></td>
  </tr>
 <!--  <tr>
    <td>
      <table width="100%"  border="0" align="center">
        <tr>
          <td width="60%">&nbsp;</td>
          <td width="40%" align="right">>><?php include("search_panel.php"); ?></td>
        </tr>
      </table></td>
  </tr> -->
 
  <tr>
    <td height="193"  class="container"><table width="100%" border="0">
      <tr>
        <td width="214" height="383" valign="top"><table width="212"  border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td></td>
            </tr>
            <tr>
              <td style="vertical-align:top;">
				<?php
			
				    if(!isset($_GET['signup']))
					include_once "left_panel.php";
				?>
			  </td>
            </tr>
        </table></td>
        <td width="700" height="300" style="vertical-align:top;"> 
              <?php
			   
			   if(isset($_GET['refer'])) {
			   include_once "refer.php";
			    	
			  }
			  /*
			  if(isset($_GET['sell'])) {
			   include_once "sell_product.php";
			    	
			  }*/
			  
			  if(isset($_GET['sell'])) { 
			  		if( !$is_pass_amazone_land ) {
						include_once "amazon_land.php";
					}	
					else {
						require_once "sell_product.php";
						//echo "1";
					}
					 
				  }  
			  else if(isset($_GET['amazon_email'])) {
			  	 require_once "amazon_email.php";				 	
			  }
			  //else if(isset($_GET['tran_history'])) {
//			  	 require_once "tran_history.php";				 	
//			  }
			  else if(isset($_GET['inbox'])) {
			  	 require_once "inbox.php";				 	
			  }
			  else if(isset($_GET['resolution'])) {
			  	 require_once "resolution.php";				 	
			  }
			   else if(isset($_GET['read'])) {
			  	 require_once "read.php";				 	
			  }
			  else if(isset($_GET['reply'])) {
			  	 require_once "reply.php";				 	
			  }
			  else if(isset($_GET['post'])) {
			  	 require_once "post.php";				 	
			  }
			  else if(isset($_GET['profile'])) {
			  	 require_once "edit_profile.php";
				 	
			  }
			  else if(isset($_GET['token_id'])) {
			  	 require_once "token_id.php";				 	
			  }
			  else if(isset($_GET['comm_token_id'])) {
			  	 require_once "comm_token_id.php";				 	
			  }
			  else if(isset($_GET['viewpro'])) {
			  	 require_once "view_profile.php";
				 	
			  }
			  else if(isset($_GET['addProduct'])) {
			  	 require_once "product_to_sell.php";
				  
			  }
			  else if(isset($_GET['srch'])) {
			  	 require_once "search_result.php";
				 
			  }
			  else if(isset($_GET['srchwhole'])) {
			 
			  	 require_once "search_whole_result.php";
				 
			  }
			   else if(isset($_GET['srchBuyer'])) {
			   if($_GET['sg']=="merchant") {
			  	 require_once "search_merchant.php";
				 }
				 else
				 {
				  require_once "search_buyer.php";
				 }
			  	
				 
			  }
			  
			  // codex technology Start here
			  else if(isset($_GET['postsearch'])) {
			  	 require_once "index.php";
			  }
			  else if(isset($_GET['srchPost'])) {
			  	 require_once "search_post.php";
				 
			  }
			  else if(isset($_GET['showPost'])) {
			  	 require_once "show_post.php";
				 
			  }
			  else if(isset($_GET['uploadFile'])) {
			  	 require_once "uploadFile.php";
				 
			  }
			  else if(isset($_GET['spid'])) {
			  	 require_once "allseller_items.php";
				 
			  }
			   else if(isset($_GET['wholeproducts'])) {
			   		if(!empty($_GET['wholeproducts'])) {
						require_once "view_whole_product.php";
						 
					} 
			   }
			  // Codex technology End Here
			  else if(isset($_GET['products'])) {
			   		if(!empty($_GET['products'])) {
						require_once "view_product.php";
						 
					} else {
						require_once "list_products.php"; 
						
					}	
			   }
			   else if(!empty($_GET['cat'])) {
					require_once "list_products.php";
					
			   }
			   else if(!empty($_GET['postcat'])) {
					require_once "list_post.php";
					
			   }
			   else if(!empty($_GET['subCat'])) {
					require_once "show_subcategories.php";
					
			   }
			   else if(isset($_GET['mylist'])) {
					require_once "my_listings.php";
					
			   }
			   else if(isset($_GET['editlist'])) {
					if(!empty($_GET['editlist'])) {
						require_once "edit_list.php";
						
					}
			   }
			    else if(isset($_GET['whole_listing'])) {
					if(!empty($_GET['whole_listing'])) {
						require_once "whole_listings.php";
						
					}
			   }
			    else if(isset($_GET['editwholeitem'])) {
					if(!empty($_GET['editwholeitem'])) {
						require_once "edit_wholesaleitem.php";
						
					}
			   }
			   else if(isset($_GET['wlist'])) {
					require_once "wishlist.php";
					 
			   }
			   else if(!empty($_GET['wishproduct'])) {
					require_once "wishlist_product.php";					
			   }
			    else if(!empty($_GET['wwishproduct'])) {
					require_once "wwishlist_product.php";					
			   }
			    else if(!empty($_GET['editjob'])) {
					require_once "editjob.php";					
			   }
			   else if(isset($_GET['signout'])) {
					signout();
					echo "<script type='text/javascript'> window.location='index.php'; </script>";
			   }			   
			   else if(isset($_GET['signin'])) {
					require_once "signin.php";
					
			   }
			  else if(isset($_GET['search'])) {
			  	 require_once "search_panel.php";
				  
			  }
			  else if(isset($_GET['confirm'])) {
			   	require_once "confirm.php";
				
			  }			  
			  else if(isset($_GET['SellProduct'])) {
			  	 require_once "product_to_view.php";
				  
			  }
			  else if(isset($_GET['editSellingProduct'])) {
			  	 require_once "product_selling_edit.php";
				  
			  }
			  else if(isset($_GET['viewItems'])) {
			  	 require_once "view_items.php";
				  
			  }
			  else if(isset($_GET['confirmRegister'])) {
			   	require_once "confirm_register.php";
				
			  }
			  else if(isset($_GET['forgotPassword'])) {
			   	require_once "forgot_password.php";
				
			  }
			  else if(isset($_GET['forgotPasswordConfirm'])) {
			   	require_once "forgot_password_confirm.php";
				
			  }
			   else if(isset($_GET['passwordChange'])) {
			   	require_once "reset_password.php";
				
			  }
			  else if(isset($_GET['signup'])) {
			   require_once "signup.php";
			   
			  } 
			  else if(isset($_GET['policy'])) {
			   	include_once "privacy_policy.php";
				
			  } 
			  else if(isset($_GET['terms'])) {
			   	include_once "terms.php";
				
			  } 
			  else if(isset($_GET['contact'])) {
			   	include_once "contact.php";
				
			  } 
			  else if(isset($_GET['registerMember'])) {
			   	include_once "register_member.php";
				
			  } 
			  else if(isset($_GET['registerMerchant'])) {
			   include_once "register_merchant.php";
			   
			   }
			   // Codex Technology 3-5-10
			   else if(isset($_GET['registerWholeseller'])) {
			   include_once "register_wholeseller.php";
			   
			   }
			   else if(isset($_GET['import']))
			   {
			   if($_GET['import']==1)
			   {
			    include_once "wholeseller_import.php";
				}
			   
			   }
			   // end
			  else if(isset($_GET['notFound'])) {
			   include_once "not_found.php";
			  }
			  else if(isset($_GET['faq'])) {
			   include_once "support/faq.php";
			  }
			  else if(isset($_GET['agreement'])) {
			   		include_once "support/agreements.php";
			  }
			   else if(isset($_GET['about'])) {
			   		include_once "about_swapen.php";
			  }
			  else if(isset($_GET['about'])) {
			   		include_once "about_swapen.php";
			  }
			  
			  else if(isset($_GET['switchto'])) {
			  	 	include_once "change_user_type.php";
			  }
			  
			  else if(isset($_GET['store'])) {
			   		include_once "add_seller_store.php";
			  }
			  
			  else if(!empty($_GET['updstore'])) {
			   	include_once "edit_seller_store.php";
			  }
			  else if(isset($_GET['cart'])) {
			  
			   include_once "cart.php";
			    	
			  }
			  else if(isset($_GET['checkout'])) {
			  
			   include_once "checkout.php";
			    	
			  }
			   else if(isset($_GET['order'])) {
			  
			   include_once "order.php";
			    	
			  }
			  else if(isset($_GET['cancelled'])) {
			  
			   include_once "cancelled.php";
			    	
			  }
			  else if(isset($_GET['process'])) {
			  
			   include_once "cancelled.php";
			    	
			  }
			  else {
			  	if(isset($_GET['mySwapen'])) {
						
						if($_SESSION['user_type_sess']=='1') {
							echo "<p align='right'>
								<input type='button' value='Seller' onclick='window.location=\"index.php?switchto\"'>
								<input type='button' value='Buyer' onclick='window.location=\"index.php?mySwapen\"'>
							</p>";	
						} else if($_SESSION['user_type_sess']=='2') {
							echo "<p align='right'>
								<input type='button' value='Seller' onclick='window.location=\"index.php?mySwapen\"'>
								<input type='button' value='Buyer' onclick='window.location=\"index.php?switchto\"'>
							</p>";	
						} else if($_SESSION['user_type_sess']=='4') {
							echo "<p align='right'>
								<input type='button' value='Seller' onclick='window.location=\"index.php?mySwapen\"'>
								<input type='button' value='Buyer' onclick='window.location=\"index.php?mySwapen&buyer\"'>
							</p>";	
						}
						else if($_SESSION['user_type_sess']=='5') {
							echo "<p align='right'>
								<input type='button' value='Seller' onclick='window.location=\"index.php?mySwapen\"'>
								<input type='button' value='Buyer' onclick='window.location=\"index.php?mySwapen&buyer\"'>
							</p>";	
						}
						
						include("panel_message.php");						
						if($_SESSION['user_type_sess']=='1') {
						    include("listing_buyer.php");
							include("post_listing.php");		
							include("panel_wishlist.php");
							require_once "tran_history.php";
							include("panel_product.php");
						}
						else if($_SESSION['user_type_sess']=='2') {
						include("post_listing.php");		
						 include("listing_seller.php");
						 include("comm_pay.php");
						 require_once "tran_history.php";
						 include("panel_product.php");
						 
						}
						else if($_SESSION['user_type_sess']=='3') {
						
						include("post_listing.php");		
						 include("listing_merchant.php");
						 include("comm_pay.php");
						 include("panel_mwishlist.php");
						 require_once "tran_history.php";
						 include("panel_product.php");
						 
						}
						else if($_SESSION['user_type_sess']=='4') {
							if(isset($_GET['buyer'])) {
								include("post_listing.php");		
								include("panel_wishlist.php");
								include("panel_product.php");
							} else {
								include("post_listing.php");		
								include("listing_seller.php");
								include("comm_pay.php");
								require_once "tran_history.php";
						 		include("panel_product.php");								
							}
						}
						else if($_SESSION['user_type_sess']=='5') {
							if(isset($_GET['buyer'])) {
								include("post_listing.php");		
								include("panel_wishlist.php");
								include("panel_product.php");
							} else {
								include("post_listing.php");		
								include("listing_seller.php");
								//include("comm_pay.php");
								require_once "tran_history.php";
						 		include("panel_product.php");
						}
						}
				}
				else {
					include_once "front.php";
				}
			  }
              ?>
			  
			  <br>           	 
		</td>
      </tr>
    </table></td>
  </tr>
  <tr>
	  	<td><?php if(empty($_GET)) {  require_once 'product_strip.php'; } ?></td>
  </tr>
  <tr>
    <td height="80"><?php include_once "footer.php";?></td>
  </tr>
</table>
</body>
</html>